package com.xoa.controller.party;

import com.xoa.model.party.InspectionRecord;
import com.xoa.service.party.InspectionRecordService;
import com.xoa.util.common.wrapper.BaseWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by 程叶同 on 2018/1/11.
 */
@Controller
@RequestMapping("inspectionrecord")
public class InpsectionRecordController {
    @Autowired
    InspectionRecordService inspectionRecordService;

    @RequestMapping("/addRecord")
    @ResponseBody
    public BaseWrapper addRecord(InspectionRecord inspectionRecord){
        return  inspectionRecordService.addRecord(inspectionRecord);
    }

    /**
     * @Author 程叶同
     * @Description 修改
     * @Date 14:49 2018/1/11
     */
    @RequestMapping("/updateRecord")
    @ResponseBody
    public BaseWrapper updateRecord(InspectionRecord inspectionRecord){
        return  inspectionRecordService.updateRecord(inspectionRecord);
    }


    /**
    * @Author 程叶同
    * @Description 删除
    * @Date 17:11 2018/1/11
    */
    @RequestMapping("/deleteRecord")
    @ResponseBody
    public BaseWrapper deleteRecord(Integer id){
        return  inspectionRecordService.deleteRecord(id);
    }

    /**
     * @Author 程叶同
     * @Description 查询单条信息
     * @Date 14:49 2018/1/11
     */
    @RequestMapping("/getRecordsById")
    @ResponseBody
    public BaseWrapper getRecordsById(HttpServletRequest request, Integer id){
        return  inspectionRecordService.getRecordsById(request,id);
    }


    /**
     * @Author 程叶同
     * @Description 列表展示
     * @Date 14:49 2018/1/11
     */
    @RequestMapping("/getList")
    @ResponseBody
    public BaseWrapper getList(HttpServletRequest request, Integer page, Integer pageSize, String startTime, String endTime, String subCounty, String problemlev){
        return  inspectionRecordService.getList(request,page,pageSize,startTime,endTime,subCounty,problemlev);
    }
}
